/**
 * @author LiuXu
 * @create 2020-07-03 20:40
 */
package com.cy.pj.goods.service.impl;

import com.cy.pj.goods.dao.GoodsDao;
import com.cy.pj.goods.pojo.Goods;
import com.cy.pj.goods.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/*
 *  商品业务层对象，负责业务逻辑处理
 */
@Service
public class GoodServiceImpl implements GoodsService {

    @Autowired
    private GoodsDao goodsDao;


    @Override
    public int saveObject(Goods entity) {
        int rows = goodsDao.insertObject(entity);
        return rows;
    }

    @Override
    public List<Goods> findObjects() {
        long start = System.currentTimeMillis();
        List<Goods> list = goodsDao.findObjects();
        long end = System.currentTimeMillis();
        System.out.println("query time:" + (end - start));
        return list;
    }


    @Override
    public int deleteById(Integer id) {
        int rows = goodsDao.deleteById(id);
        return rows;
    }

}
